<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var a = 10;
    var foo = function (){

        alert('a'+a);
        var a = 20;
        alert('b'+a);
    }

    foo();
    alert('d'+a);

    //var 声明,在内存中开辟一个新空间，用来存放数据，undefined



</script>
</body>
</html>